Skip to content

DateRangeBox: improve typing - #34601

Open
EugeniyKiyashko wants to merge 2 commits into
DevExpress:mainfrom
EugeniyKiyashko:26_2_dateRangeBox_improve_typing
Open

DateRangeBox: improve typing#34601
EugeniyKiyashko wants to merge 2 commits into
DevExpress:mainfrom
EugeniyKiyashko:26_2_dateRangeBox_improve_typing

Conversation

@EugeniyKiyashko

Copy link
Copy Markdown
Contributor

No description provided.

@EugeniyKiyashko EugeniyKiyashko self-assigned this Jul 31, 2026
@EugeniyKiyashko
EugeniyKiyashko requested a review from a team as a code owner July 31, 2026 15:33
Copilot AI review requested due to automatic review settings July 31, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the DateRangeBox implementation to use the non-m_ internal module names and improves TypeScript typings across DateRangeBox, its multiselect DateBox, and related DateBox strategies—primarily by introducing stronger option/event types and reducing @ts-expect-error usage.

Changes:

  • Switched DateRangeBox public entry and internal imports from m_* modules to the new date_range_* modules.
  • Tightened types in Editor, DateRangeBox, MultiselectDateBox, and RangeCalendarStrategy (options, events, and return types).
  • Standardized keyboard handler typings to use DxEvent<KeyboardEvent> in DateBox strategies.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/devextreme/js/ui/date_range_box.js Updates the public entry import to the renamed internal DateRangeBox module.
packages/devextreme/js/__internal/ui/editor/editor.ts Broadens editor typing constraint so validationMessagePosition can include 'auto' (Mode) for components that resolve position themselves.
packages/devextreme/js/__internal/ui/date_range_box/strategy/rangeCalendar.ts Refactors RangeCalendar strategy typings (value/event/popup), and aligns keyboard handlers with DxEvent.
packages/devextreme/js/__internal/ui/date_range_box/multiselect_date_box.ts Improves MultiselectDateBox typing, switches to internal DateBox import, and updates event/option handler types.
packages/devextreme/js/__internal/ui/date_range_box/m_date_range.utils.ts Removes legacy m_ utility module.
packages/devextreme/js/__internal/ui/date_range_box/date_range.utils.ts Adds typed DateRangeBox date utilities (getDeserializedDate, comparisons, sorting).
packages/devextreme/js/__internal/ui/date_range_box/date_range_box.ts Reworks DateRangeBox typings (properties, events, option handling) and updates internal dependencies to new module names.
packages/devextreme/js/__internal/ui/date_box/date_box.strategy.ts Updates supportedKeys handler typing to DxEvent<KeyboardEvent>.
packages/devextreme/js/__internal/ui/date_box/date_box.strategy.list.ts Updates supportedKeys handler typing to DxEvent<KeyboardEvent>.
packages/devextreme/js/__internal/ui/date_box/date_box.strategy.calendar.ts Updates supportedKeys handler typing to DxEvent<KeyboardEvent>.
Suppressed comments (2)

packages/devextreme/js/__internal/ui/date_range_box/strategy/rangeCalendar.ts:196

  • value[0] is a DateLike (can be 0), so a falsy check incorrectly treats valid timestamps like 0 (Unix epoch) as “missing”. Use a nullish check instead.

This issue also appears on line 215 of the same file.
packages/devextreme/js/__internal/ui/date_range_box/strategy/rangeCalendar.ts:219

  • This condition uses && value[0] which treats valid DateLike values like 0 as absent. Prefer a nullish check so epoch timestamps don’t skip the out-of-range correction.

Copilot AI review requested due to automatic review settings July 31, 2026 22:22
@EugeniyKiyashko
EugeniyKiyashko force-pushed the 26_2_dateRangeBox_improve_typing branch from f2b1f77 to c99dc9e Compare July 31, 2026 22:22
@EugeniyKiyashko
EugeniyKiyashko requested a review from a team as a code owner July 31, 2026 22:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

packages/devextreme/js/__internal/ui/overlay/overlay.ts:936

  • Same generic type mismatch as above: pushing this into Overlay[] may be a TS error if Overlay<TProperties> is not assignable to Overlay<OverlayProperties>.

Cast this to the stack element type (or adjust OVERLAY_STACK typing).

    if (!isInStack) {
      this._zIndex = zIndex ?? zIndexPool.create(this._zIndexInitValue());
      overlayStack.push(this);
    }

packages/devextreme/js/__internal/ui/overlay/overlay.ts:922

  • Same generic type mismatch as above: overlayStack.indexOf(this) may be a TS error if this (Overlay) is not assignable to Overlay<OverlayProperties>.

Cast this to the stack element type (or adjust OVERLAY_STACK typing).

  _updateZIndexStackPosition(pushToStack: boolean): void {
    const overlayStack = this._overlayStack();
    const index = overlayStack.indexOf(this);
    const isInStack = index !== -1;
    const { zIndex } = this.option();

packages/devextreme/js/__internal/ui/drop_down_editor/drop_down_list.ts:221

  • _initContentReadyAction assigns to this._contentReadyAction, but the class does not declare _contentReadyAction. Without an existing declaration on DropDownEditor, this is a TypeScript error (property does not exist) and will break compilation.

Declare _contentReadyAction on DropDownList (or move it to the base class if it is shared).

  _initContentReadyAction(): void {
    this._contentReadyAction = this._createActionByOption('onContentReady', {
      excludeValidators: ['disabled', 'readOnly'],
    });
  }

const overlayStack = this._overlayStack();
const innerOverlayElement = $closestInnerOverlay.get(0);
// @ts-expect-error this and Overlay have no overlap
const thisIndex = overlayStack.indexOf(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants